import Main from '@/views/Main.vue';


// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: 'Login - 登录'
    },
    component: resolve => void(require(['@/views/login.vue'], resolve)), // 懒加载 () => import('@/views/login.vue')
};

export const page404 = {
    path: '/*',
    name: 'error-404',
    meta: {
        title: '404-页面不存在'
    },
    component: resolve => void(require(['@/views/error-page/404.vue'], resolve)), // 懒加载 () => import('@/views/error-page/404.vue')
};

export const page403 = {
    path: '/403',
    meta: {
        title: '403-权限不足'
    },
    name: 'error-403',
    component: resolve => void(require(['@/views/error-page/403.vue'], resolve)), // 懒加载 () => import('@//views/error-page/403.vue')
};

export const page500 = {
    path: '/500',
    meta: {
        title: '500-服务端错误'
    },
    name: 'error-500',
    component: resolve => void(require(['@/views/error-page/500.vue'], resolve)), // 懒加载 () => import('@/views/error-page/500.vue')
};

export const locking = {
    path: '/locking',
    name: 'locking',
    component: resolve => void(require(['@/views/main-components/lockscreen/components/locking-page.vue'], resolve)), // 懒加载 () => import('@/views/main-components/lockscreen/components/locking-page.vue')
};

// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    redirect: '/home',
    component: Main,
    children: [{
            path: 'home',
            title: {
                i18n: 'home'
            },
            name: 'home_index',
            component: resolve => void(require(['@/views/home/home.vue'], resolve)),
        },
        {
            path: 'ownspace',
            title: '个人中心',
            name: 'ownspace_index',
            component: resolve => void(require(['@/views/own-space/own-space.vue'], resolve)),
        }, // 懒加载 () => import('@/views/own-space/own-space.vue') },
    ]
};

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [{
    path: "/alarm-monitor",
    icon: "ios-infinite",
    name: "alarm-monitor",
    access: 0,
    title: "报警监控",
    component: Main,
    children: [{
        path: "home",
        title: "报警监控",
        access: 0,
        name: "home",
        meta: {
            actions: []
        },
        icon: "link",
        component: resolve => void require(["@/views/home/home.vue"], resolve)
    }, {
        path: "heart-beat",
        title: "心跳监控",
        access: 0,
        name: "heart-beat",
        meta: {
            actions: []
        },
        icon: "link",
        component: resolve => void require(["@/views/monitor/heart-beat/heartBeat.vue"], resolve)
    }, {
        path: "big-screen-monitor",
        title: "大屏数据",
        access: 0,
        name: "big-screen-monitor",
        meta: {
            actions: []
        },
        icon: "link",
        component: resolve => void require(["@/views/monitor/big-screen-monitor/big-screen-monitor.vue"], resolve)
    }, {
        path: "big-screen-map",
        title: "大屏监控",
        access: 0,
        name: "big-screen-map",
        meta: {
            actions: []
        },
        icon: "link",
        component: resolve => void require(["@/views/monitor/big-screen-map/big-screen-map.vue"], resolve)
    }]
}, {
    path: "/asset-manage",
    icon: "ios-infinite",
    name: "asset-manage",
    access: 0,
    title: "资源管理",
    component: Main,
    children: [{
        path: "deviceTable",
        title: "设备管理",
        access: 0,
        name: "deviceTable",
        meta: {
            actions: []
        },
        icon: "link",
        component: resolve => void require(["@/views/asset-manage/device-manage/deviceTable.vue"], resolve)
    }]
}, {
    path: "/network-unit",
    icon: "ios-infinite",
    name: "network-unit",
    access: 0,
    title: "联网单位管理",
    component: Main,
    children: [{
        path: "groupCompanyTable",
        title: "联网单位",
        access: 0,
        name: "groupCompanyTable",
        meta: {
            actions: []
        },
        icon: "link",
        component: resolve => void require(["@/views/network-unit/group-company/groupCompanyTable.vue"], resolve)
    }, {
        path: "maintenanceTable",
        title: "维保单位",
        access: 0,
        name: "maintenanceTable",
        meta: {
            actions: []
        },
        icon: "link",
        component: resolve => void require(["@/views/network-unit/maintenance/maintenanceTable.vue"], resolve)
    }, {
        path: "buildingsTable",
        title: "子单位",
        access: 0,
        name: "buildingsTable",
        meta: {
            actions: []
        },
        icon: "link",
        component: resolve => void require(["@/views/network-unit/buildings/buildingsTable.vue"], resolve)
    }, {
        path: "areasTable",
        title: "区域管理",
        access: 0,
        name: "areasTable",
        meta: {
            actions: []
        },
        icon: "link",
        component: resolve => void require(["@/views/network-unit/areas/areasTable.vue"], resolve)
    }]
}, {
    path: "/customer-manage",
    icon: "ios-infinite",
    name: "customer-manage",
    access: 0,
    title: "客户管理",
    component: Main,
    children: [{
        path: "mobile-user",
        title: "微信用户",
        access: 0,
        name: "mobile-user",
        meta: {
            actions: []
        },
        icon: "link",
        component: resolve => void require(["@/views/customer-manage/mobile-user/mobile-user.vue"], resolve)
    }]
}, {
    path: "/sys-manage",
    icon: "ios-infinite",
    name: "sys-manage",
    access: 0,
    title: "系统管理",
    component: Main,
    children: [{
        path: "functionTable",
        title: "功能管理",
        access: 0,
        name: "functionTable",
        meta: {
            actions: []
        },
        icon: "link",
        component: resolve => void require(["@/views/sys-manage/function/functionTable.vue"], resolve)
    }, {
        path: "userTable",
        title: "用户管理",
        access: 0,
        name: "userTable",
        meta: {
            actions: []
        },
        icon: "link",
        component: resolve => void require(["@/views/sys-manage/user/userTable.vue"], resolve)
    }, {
        path: "roleTable",
        title: "角色管理",
        access: 0,
        name: "roleTable",
        meta: {
            actions: []
        },
        icon: "link",
        component: resolve => void require(["@/views/sys-manage/role/roleTable.vue"], resolve)
    }, {
        path: "deptTable",
        title: "部门管理",
        access: 0,
        name: "deptTable",
        meta: {
            actions: []
        },
        icon: "link",
        component: resolve => void require(["@/views/sys-manage/dept/deptTable.vue"], resolve)
    }, {
        path: "logTable",
        title: "操作日志",
        access: 0,
        name: "logTable",
        meta: {
            actions: []
        },
        icon: "link",
        component: resolve => void require(["@/views/sys-manage/log/logTable.vue"], resolve)
    }, {
        path: "testPage",
        title: "电信IOT",
        access: 0,
        name: "testPage",
        meta: {
            actions: []
        },
        icon: "link",
        component: resolve => void require(["@/views/sys-manage/testPage/testPage.vue"], resolve)
    }]
}]; // 懒加载 () => import('@/views/sys-manage/function/functionTable.vue') }, // 懒加载() => import('@/views/sys-manage/user/userTable.vue') }, // 懒加载() => import('@/views/sys-manage/role/roleTable.vue') }

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter,
    otherRouter,
    locking,
    ...appRouter,
    page500,
    page403,
    page404
];